package com.bs.service.impl;

import com.bs.bean.User;
import com.bs.mapper.UserMapper;
import com.bs.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public User login(String username, String password) {
        return userMapper.login(username,password);
    }

    @Override
    public void save(User user) {
        userMapper.save(user);
    }

    @Override
    public User getUserByUserName(String username) {
        return userMapper.getUserByUserName(username);
    }

    @Override
    public void updatePasswordByUserName(String md5Pwd, String email, String username2, String username) {
        userMapper.updatePasswordByUserName(md5Pwd, email, username2, username);
    }


    @Override
    public List<User> getScoreBoardList() {
        return userMapper.getScoreBoardList();
    }

    @Override
    public User getUserById(Integer id) {
        return userMapper.getUserById(id);
    }

    @Override
    public void updateOnlineState(String username, boolean isOnline) {
        userMapper.updateOnlineState(username, isOnline);
    }

    @Override
    public User searchUsersByKeyword(String keyword) {
        return userMapper.searchUsersByUsername(keyword);
    }

    @Override
    public void updatePicture(String username, String picture) {
        userMapper.updatePicture(username, picture);
    }


}
